package com.mq.order;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ytj
 * @date 2024/1/23
 */
@Configuration
public class Demo11Config {
    @Bean
    public Queue demo11Queue0(){
        return new Queue(Demo11Message.QUEUE0,true,false,false);
    }

    @Bean
    public Queue demo11Queue1(){
        return new Queue(Demo11Message.QUEUE1,true,false,false);
    }

    @Bean
    public Queue demo11Queue2(){
        return new Queue(Demo11Message.QUEUE2,true,false,false);
    }

    @Bean
    public Queue demo11Queue3(){
        return new Queue(Demo11Message.QUEUE3,true,false,false);
    }

    @Bean
    public DirectExchange demo11Exchanger() {
        return new DirectExchange(Demo11Message.BASE_EXCHANGE,true,false);
    }

    @Bean
    public Binding demo11Binding0(){
        return BindingBuilder.bind(demo11Queue0()).to(demo11Exchanger()).with("0");
    }

    @Bean
    public Binding demo11Binding1(){
        return BindingBuilder.bind(demo11Queue1()).to(demo11Exchanger()).with("1");
    }

    @Bean
    public Binding demo11Binding2(){
        return BindingBuilder.bind(demo11Queue2()).to(demo11Exchanger()).with("2");
    }

    @Bean
    public Binding demo11Binding3(){
        return BindingBuilder.bind(demo11Queue3()).to(demo11Exchanger()).with("3");
    }
}
